package com.time.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.time.domain.Product;
import com.time.mapper.ProductMapper;
import com.time.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 张龙佼
 * @Description 商品信息 service接口实现
 * @since 2020-10-19
 */

@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product>
        implements ProductService {

    @Autowired
    private ProductMapper productMapper;

    @Override
    public Page<Product> getProductByPcChildId(Integer pcChildId, Page<Product> page) {
        LambdaQueryWrapper<Product> productQuery = new LambdaQueryWrapper<>();
        productQuery.eq(Product::getPcChildId, pcChildId);

        return productMapper.selectPage(page, productQuery);
    }
}
